<?php
/**
 * Created by PhpStorm.
 * User: l-ht
 * Date: 2018/11/12
 * Time: 11:35
 */

namespace app\admin\controller;


use think\Controller;

class Base extends Controller
{

    public function __construct()
    {
        if (!cookie('user')) {
            return $this->redirect('Login/login');
        }
    }

    //成功响应
    public function _toSuccess($data = [])
    {
        $data['code'] = 200;
        return json()->data($data,200);
    }

    //失败响应
    public function _toError($data = [])
    {
        $data['code'] = 500;
        return json()->data($data,500);

    }
}